"use strict";

var headerConfirmFlag = "headerConfirm_";
var headerEditFlag = "headerEdit_";

var headerWrap = {
    template: headerTem,
    methods: {
        confirm: function confirm() {
            APP.$emit(headerConfirmFlag + store.state.showFlag);
        },
        edit: function edit() {
            APP.$emit(headerEditFlag + store.state.showFlag);
        }
    }
};

var loadingWrap = Vue.component('loadingWrap', { template: loadingTem });
var bodyWrap = Vue.component('bodyWrap', {
    template: bodyTem,
    props: {
        isShow: {
            type: Boolean,
            default: false
        }
    }
});
var noDataWrap = { template: noDataTem };
//折叠item
var foldWrap = {
    template: foldTem,
    props: {
        list: {
            default: []
        }
    },
    data: function data() {
        return {
            flag: 1
        };
    },

    methods: {
        _open: function _open(v) {
            this.flag = v;
            var arr = this.$refs.fold.parentNode.childNodes[2].children;
            for (var i = 0; i < arr.length; i++) {
                publicMethods.togClass(arr[i], "fold-hide");
            }
        }
    }
};
var searchWrap = {
    template: searchTem,
    methods: {
        inputValue: function inputValue(e) {
            this.$emit("inputValue", e.target.value);
        }
    }
};
// 发起对话 拨打电话
var actionSheetWrap = {
    template: actionSheetTem,
    props: {
        isShow: {
            type: Boolean,
            default: false
        },
        actionData: {
            type: Array,
            default: []
        }
    },
    data: function data() {
        return {
            wrapShow: false,
            itemShow: false
        };
    },

    methods: {
        check: function check(v) {
            this.$emit("check", v);
            this.cancel();
        },
        cancel: function cancel() {
            var _this = this;

            this.wrapShow = false;
            this.itemShow = false;
            setTimeout(function () {
                _this.$emit("cancel", false);
            }, 200);
        }
    },
    watch: {
        isShow: function isShow() {
            var _this2 = this;

            if (this.isShow) {
                setTimeout(function () {
                    _this2.wrapShow = true;
                    _this2.itemShow = true;
                }, 20);
            }
        }
    }

};
var detailsItemWrap = {
    template: detailsItemTem,
    props: {
        list: {
            type: Object,
            default: {}
        }
    },
    components: {
        foldWrap: foldWrap
    }
};

//人员列表
var peopleListWrap = {
    template: peopleListTem,
    data: function data() {
        return {
            flag: true,
            checked: {
                leader: "",
                releaseCs: [],
                releaseDf: [],
                dwList: []
            },
            checkedKey: "",
            nameKey: "",
            inputType: "",
            searchList: [],
            imgUrl: ""
        };
    },

    methods: {
        init: function init() {
            var _this3 = this;

            this.id = parseInt(GetQueryString("roleId"));
            headerTitleChange(111);
            switch (this.id) {
                //请示领导
                case 1:
                    this.inputType = "radio";
                    publicData.peopleListKey = "peopleList";
                    this.imgUrl = "./img/q.png";
                    break;
                //下发地方网信办
                case 3:
                    this.inputType = "checkbox";
                    publicData.peopleListKey = "dfList";
                    this.imgUrl = "./img/org.png";
                    break;
                //下发安全厂商
                case 5:
                    this.inputType = "checkbox";
                    publicData.peopleListKey = "csList";
                    this.imgUrl = "./img/org.png";
                    break;
                //下发运营单位
                case 7:
                    this.inputType = "checkbox";
                    publicData.peopleListKey = "dwList";
                    this.imgUrl = "./img/org.png";
                    break;
            }
            this.checkedKey = publicData.keyDetailsVal[this.id];
            if (publicData[publicData.peopleListKey].length === 0) {
                if (this.id === 7) {
                    var orgID = userInfo.orgID;
                    ajax_.postType(ajax_.orgList, { orgID: orgID }, function (data) {
                        var dd = data.result.map(function (i) {
                            return {
                                orgName: i.orgName,
                                id: i.orgID
                            };
                        });
                        publicData[publicData.peopleListKey] = dd;
                        _this3.searchList = dd;
                    });
                } else {
                    ajax_.getType("user", { roleID: this.id }, function (data) {
                        publicData[publicData.peopleListKey] = data;
                        _this3.searchList = data;
                    });
                }
            } else {
                this.searchList = publicData[publicData.peopleListKey];
            }
            store.commit("_headerType", 2);
            this.checked[this.checkedKey] = publicData[this.checkedKey];
            this.nameKey = publicData.keyOrgNameDetail[this.id];
        },
        inputValue: function inputValue(v) {
            var k = v.toString().trim();
            if (k != "") {
                this.searchList = publicData[publicData.peopleListKey].filter(function (v) {
                    return v.linkdoodName.indexOf(k) != -1;
                });
            } else {
                this.searchList = publicData[publicData.peopleListKey];
            }
        },
        confirmBack: function confirmBack() {
            var _this4 = this;

            alert_(function () {
                scrollTriggerDownScroll();
                _this4.flag = false;
                goBack(-2);
                publicData.leader = "";
            });
        },
        newsSubmit: function newsSubmit(data) {
            var _this5 = this;

            ajax_.confirmPutTypeWithLoading("bulletinApproval/" + publicData.itemDetails.id, data, function () {
                _this5.confirmBack();
            });
        },
        eventAndWarnSubmit: function eventAndWarnSubmit(data) {
            var _this6 = this;

            ajax_.confirmPutTypeWithLoading(ajax_.eventAndWarnUpdateUrl, data, function () {
                _this6.confirmBack();
            });
        }
    },
    components: {
        searchWrap: searchWrap
    },
    created: function created() {
        this.init();
    },
    mounted: function mounted() {
        var _this7 = this;

        APP.$on(headerConfirmFlag + "111", function () {
            if (_this7.id == 1) {
                publicData.leader = _this7.checked.leader;
                var data = {
                    advice: adviceTextarea,
                    approvalUserID: _this7.checked.leader.linkdoodID,
                    type: 1 //1.转批  2.同意  3.退回
                };
                switch (getHeader.type) {
                    case 1:
                        _this7.newsSubmit(data);
                        break;
                    case 2:
                    case 3:
                        data.baseID = publicData.details.baseID;
                        _this7.eventAndWarnSubmit(data);
                        break;
                }
            } else {
                APP.$emit("peopleListCheck", { checked: _this7.checked[_this7.checkedKey], id: _this7.id });
                publicData[_this7.checkedKey] = _this7.checked[_this7.checkedKey];
                goBack();
            }
        });
        headerTitleChange(111);
    },
    beforeDestroy: function beforeDestroy() {
        APP.$off(headerConfirmFlag + "111");
        if (getHeader.type === 1) {
            store.dispatch("showFlag_action", 1);
        } else {
            store.dispatch("showFlag_action", 20);
        }
        store.commit("_headerType", 99);
    }
};

//letter buddyName,buddyID，imgUrl
var contactsWrap = {
    template: contactsTem,
    data: function data() {
        return {
            list: {},
            keywords: "",
            checked: [],
            switchFlag: 1
        };
    },

    methods: {
        init: function init() {
            var _this8 = this;

            this.list = vrvInit.contactList;
            this.checked = publicData.leader;
            store.commit("_headerType", 2);
            store.dispatch("showFlag_action", 21);
            publicMethods.headerConfirm = function () {
                publicData.leader = _this8.checked;
                alert(JSON.stringify(_this8.checked));
                goBack();
            };
        },
        inputValue: function inputValue(v) {
            var k = v.toString().trim();
            if (k != "") {
                var d = { a: { letter: "", arr: [] } };
                d.a.arr = vrvInit.contactListForSearch.filter(function (v) {
                    return v.buddyName.indexOf(k) != -1;
                });
                this.list = d;
            } else {
                this.list = vrvInit.contactList;
            }
        }
    },
    components: {
        loadingWrap: loadingWrap,
        searchWrap: searchWrap
    },
    created: function created() {
        this.init();
    },
    beforeDestroy: function beforeDestroy() {
        store.commit("_headerType", 0);
        publicMethods.backDetail();
    }
};

var adviceTextarea = "";
//主动下拉刷新列表
var scrollTriggerDownScroll = function scrollTriggerDownScroll() {
    pendingScroll.triggerDownScroll();
    completeScroll.triggerDownScroll();
};

// 首页列表页 userInfo.roleRank  1: 领导 2：值班员 3：地方联络员
var indexPage = {
    template: indexTem,
    data: function data() {
        return {
            show: true,
            loadingShow: false,
            switchFlag: 0,
            pageSize: 20,
            pendingPageIndex: 1,
            completePageIndex: 1,
            switchList: ["在办事宜", "办结事宜"],
            pendingList: [],
            completeList: [],
            header: "预警管理"
        };
    },

    methods: {
        init: function init() {
            var _this9 = this;

            var v = JSON.parse(sessionStorage.getItem("urlVal"));
            userInfo.id = v.userInfo.createUserInfo.linkdoodID;
            userInfo.orgID = v.userInfo.createUserInfo.orgID;
            userInfo.roleRank = v.userInfo.createUserInfo.roleID;
            getHeader.type = parseInt(sessionStorage.getItem("urlType"));
            getHeader.txt = getHeader.getHeaderTxt();
            if (getHeader.type === 1) {
                store.dispatch("showFlag_action", 1);
                store.commit("_title", getHeader.getHeaderTxt());
            } else {
                store.commit("_title", getHeader.getHeaderTxt() + "管理");
                store.dispatch("showFlag_action", 20);
            }
            getUserType(function () {
                setTimeout(function () {
                    _this9.pendingListInit();
                    _this9.completeListInit();
                }, 100);
            });
        },
        pendingListInit: function pendingListInit() {
            var _this10 = this;

            window.pendingScroll = new MeScroll("pending", {
                //刷新
                down: {
                    auto: true,
                    callback: function callback() {
                        _this10.getList(getHeader.type, 1, 1);
                    }
                },
                //加载更多
                up: {
                    page: {
                        size: this.size
                    },
                    auto: false,
                    loadFull: {
                        use: false,
                        delay: 500
                    },
                    htmlNodata: '<p class="upwarp-nodata">-- 暂无更多数据 --</p>',
                    callback: function callback() {
                        _this10.getList(getHeader.type, 1, 2);
                    }
                }
            });
        },
        completeListInit: function completeListInit() {
            var _this11 = this;

            window.completeScroll = new MeScroll("complete", {
                //刷新
                down: {
                    auto: true,
                    callback: function callback() {
                        _this11.getList(getHeader.type, 2, 1);
                    }
                },
                //加载更多
                up: {
                    page: {
                        size: this.size
                    },
                    auto: false,
                    loadFull: {
                        use: false,
                        delay: 500
                    },
                    htmlNodata: '<p class="upwarp-nodata">-- 暂无更多数据 --</p>',
                    callback: function callback() {
                        _this11.getList(getHeader.type, 2, 2);
                    }
                }
            });
        },
        getList: function getList(v, p, c) {
            var _this12 = this;

            /*
             v：加载列表类型
             p：1：待处理 2：已完结
             c：1：刷新 2：加载更多
             detailPath：详情跳转页
             */
            publicMethods.isDF(function () {
                _this12.detailPath = function (item) {
                    return "/details?id=" + item.baseID;
                };
                switch (v) {
                    case 1:
                        _this12.detailPath = function (item) {
                            var v = "/news?id=" + item.id;
                            return v;
                        };
                        _this12.newsListInit(p, c);
                        break;
                    case 2:
                        _this12.eventListInit(p, c);
                        break;
                    case 3:
                        _this12.warnListInit(p, c);
                        break;
                }
            }, function () {
                _this12.detailPath = function (item) {
                    return "/details?id=" + item.id;
                };
                _this12.feedBackListGet(v, p, c);
            });
        },

        // listFlag 1：待处理 2：已完结     scrollFlag 1：刷新 2：加载更多
        newsListInit: function newsListInit(listFlag, scrollFlag) {
            var _this13 = this;

            var data = {
                userID: userInfo.id,
                size: this.pageSize
            };
            //今日快报待处理
            if (listFlag === 1) {
                data.type = 0;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.pendingPageIndex = 1;
                    ajax_.getType(ajax_.newsUrl, data, function (v) {
                        _this13.pendingList = _this13.newsListFormat(v.records, 1);
                        pendingScroll.endSuccess(v.records.length);
                        _this13.loadingShow = true;
                    });
                } else {
                    // 加载更多
                    data.page = this.pendingPageIndex + 1;
                    ajax_.getType(ajax_.newsUrl, data, function (v) {
                        _this13.pendingList = _this13.pendingList.concat(_this13.newsListFormat(v.records, 1));
                        pendingScroll.endSuccess(v.records.length);
                    });
                }
            } else {
                //今日快报完结列表
                data.type = 1;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.completePageIndex = 1;
                    ajax_.getType(ajax_.newsUrl, data, function (v) {
                        _this13.completeList = _this13.newsListFormat(v.records, 2);
                        completeScroll.endSuccess(v.records.length);
                    });
                } else {
                    // 加载更多
                    data.page = this.completePageIndex + 1;
                    ajax_.getType(ajax_.newsUrl, data, function (v) {
                        _this13.completeList = _this13.completeList.concat(_this13.newsListFormat(v.records, 2));
                        completeScroll.endSuccess(v.records.length);
                    });
                }
            }
        },
        eventListInit: function eventListInit(listFlag, scrollFlag) {
            var _this14 = this;

            var data = {
                userID: userInfo.id,
                size: this.pageSize
            };
            if (listFlag === 1) {
                data.status = 1;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.pendingPageIndex = 1;
                    ajax_.getType(ajax_.eventUrl, data, function (v) {
                        _this14.pendingList = _this14.eventAndWarnListFormat(v.records, 1);
                        pendingScroll.endSuccess(v.records.length);
                        _this14.loadingShow = true;
                    });
                } else {
                    // 加载更多
                    data.page = this.pendingPageIndex++;
                    ajax_.getType(ajax_.eventUrl, data, function (v) {
                        _this14.pendingList = _this14.pendingList.concat(_this14.eventAndWarnListFormat(v.records, 1));
                        pendingScroll.endSuccess(v.records.length);
                    });
                }
            } else {
                //完结列表
                data.status = 2;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.completePageIndex = 1;
                    ajax_.getType(ajax_.eventUrl, data, function (v) {
                        _this14.completeList = _this14.eventAndWarnListFormat(v.records, 2);
                        completeScroll.endSuccess(v.records.length);
                    });
                } else {
                    // 加载更多
                    data.page = this.completePageIndex++;
                    ajax_.getType(ajax_.eventUrl, data, function (v) {
                        _this14.completeList = _this14.completeList.concat(_this14.eventAndWarnListFormat(v.records, 2));
                        completeScroll.endSuccess(v.records.length);
                    });
                }
            }
        },
        warnListInit: function warnListInit(listFlag, scrollFlag) {
            var _this15 = this;

            var data = {
                userID: userInfo.id,
                size: this.pageSize
            };
            if (listFlag === 1) {
                data.status = 1;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.pendingPageIndex = 1;
                    ajax_.getType(ajax_.warnUrl, data, function (v) {
                        var len = v.records.length;
                        _this15.pendingList = _this15.eventAndWarnListFormat(v.records, 1);
                        pendingScroll.endBySize(len, _this15.size);
                        _this15.loadingShow = true;
                    });
                } else {
                    // 加载更多
                    data.page = this.pendingPageIndex + 1;
                    ajax_.getType(ajax_.warnUrl, data, function (v) {
                        var len = v.records.length;
                        _this15.pendingList = _this15.pendingList.concat(_this15.eventAndWarnListFormat(v.records, 1));
                        pendingScroll.endBySize(len, _this15.size);
                    });
                }
            } else {
                //完结列表
                data.status = 2;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.completePageIndex = 1;
                    ajax_.getType(ajax_.warnUrl, data, function (v) {
                        _this15.completeList = _this15.eventAndWarnListFormat(v.records, 2);
                        completeScroll.endSuccess(v.records.length);
                    });
                } else {
                    // 加载更多
                    data.page = this.completePageIndex++;
                    ajax_.getType(ajax_.warnUrl, data, function (v) {
                        _this15.completeList = _this15.completeList.concat(_this15.eventAndWarnListFormat(v.records, 2));
                        completeScroll.endSuccess(v.records.length);
                    });
                }
            }
        },
        newsListFormat: function newsListFormat(arr, type) {
            if (arr.length) {
                return arr.map(function (i) {
                    if (type === 1) {
                        if (i.approvalUserID == userInfo.id) {
                            i.stateClass = "i-state-pend";
                            i.stateTxt = "待办";
                        } else {
                            i.stateClass = "i-state-done";
                            i.stateTxt = "已办";
                        }
                    } else if (type === 2) {
                        i.stateClass = "i-state-complete";
                        i.stateTxt = "办结";
                    }
                    i.iconClass = "icon-hxzfont08";
                    i.title = i.name;
                    i.updateTime = i.updateTime;
                    return i;
                });
            } else {
                return [];
            }
        },
        eventAndWarnListFormat: function eventAndWarnListFormat(arr, type) {
            return arr.map(function (i) {
                if (type === 1) {
                    if (i.approvalUserID == userInfo.id) {
                        i.stateClass = "i-state-pend";
                        i.stateTxt = "待办";
                    } else {
                        i.stateClass = "i-state-done";
                        i.stateTxt = "已办";
                    }
                } else if (type === 2) {
                    i.stateClass = "i-state-complete";
                    i.stateTxt = "办结";
                }
                if (getHeader.type === 3) {
                    i.iconClass = "icon-yujing";
                    i.iconWrapClass = "warn" + i.warningLevel;
                } else {
                    i.iconClass = "icon-hxzfont08";
                }
                return i;
            });
        },

        //地方网信办 厂商 单位待办已办接口
        feedBackListGet: function feedBackListGet(type, listFlag, scrollFlag) {
            var _this16 = this;

            var url = ajax_.eventAndFeedbackList[type];
            var status1 = JSON.stringify([0, 1]);
            var status2 = JSON.stringify([2]);
            var data = {
                orgID: userInfo.orgID,
                size: this.pageSize
            };
            if (listFlag === 1) {
                data.statusList = status1;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.pendingPageIndex = 1;
                    ajax_.postType(url, data, function (v) {
                        _this16.pendingList = _this16.feedBackListFormat(v.result.records, 1);
                        var len = v.result.records.length;
                        pendingScroll.endSuccess(len);
                        _this16.loadingShow = true;
                    });
                } else {
                    // 加载更多
                    data.page = this.pendingPageIndex + 1;
                    ajax_.postType(url, data, function (v) {
                        _this16.pendingList = _this16.pendingList.concat(_this16.feedBackListFormat(v.result.records, 1));
                        pendingScroll.endSuccess(v.result.records.length);
                    });
                }
            } else {
                //完结列表
                data.statusList = status2;
                if (scrollFlag === 1) {
                    //刷新待处理列表
                    data.page = 1;
                    this.completePageIndex = 1;
                    ajax_.postType(url, data, function (v) {
                        _this16.completeList = _this16.feedBackListFormat(v.result.records, 2);
                        completeScroll.endSuccess(v.result.records.length);
                    });
                } else {
                    // 加载更多
                    data.page = this.completePageIndex + 1;
                    ajax_.postType(url, data, function (v) {
                        _this16.completeList = _this16.completeList.concat(_this16.feedBackListFormat(v.result.records, 2));
                        completeScroll.endSuccess(v.result.records.length);
                    });
                }
            }
        },
        feedBackListFormat: function feedBackListFormat(arr) {
            var keys = ["", "", "eventManageTable", "riskManageTable"][getHeader.type];
            if (arr.length) {
                return arr.map(function (i) {
                    if (i.status == 0) {
                        i.stateClass = "i-state-pend";
                        i.stateTxt = "待办";
                    } else if (i.status == 1) {
                        i.stateClass = "i-state-done";
                        i.stateTxt = "已办";
                    } else {
                        i.stateClass = "i-state-complete";
                        i.stateTxt = "办结";
                    }
                    if (getHeader.type === 3) {
                        i.iconClass = "icon-yujing";
                        if (i.riskManageTable && i.riskManageTable.warningLevel) {
                            i.iconWrapClass = "warn" + i.riskManageTable.warningLevel;
                        }
                    } else {
                        i.iconClass = "icon-hxzfont08";
                    }
                    if (i[keys]) {
                        i.title = i[keys].title;
                        i.updateTime = i[keys].updateTime;
                    } else {
                        i.title = "";
                        i.updateTime = "";
                    }
                    return i;
                });
            } else {
                return [];
            }
        },
        go_details: function go_details(item) {
            publicData.itemDetail = item;
            goPathWithParams(this.detailPath(item));
        }
    },
    components: {
        headerWrap: headerWrap,
        noDataWrap: noDataWrap
    },
    mounted: function mounted() {
        if (GetQueryString("isPush").toString() != "1") {
            this.init();
        }
    }
};

//事件 预警详情页面
var detailsPage = {
    template: detailsTem,
    data: function data() {
        return {
            actionShow: false,
            bodyShow: false,
            details: {},
            switch_cs_show: false,
            pageUpShow: false,
            dealFeedBackActionShow: false,
            feedBackHistoryShow: false,
            pageUpShowDW: false,
            actionUserID: "",
            actionUserPhone: "",
            actionData: [{ txt: '发起对话', iconClass: "action-icon-chat", value: "c1" }, { txt: '拨打电话', iconClass: "action-icon-call", value: "c2" }],
            dealFeedBackActionData: [{ txt: '继续跟踪', iconClass: "", value: 2 }, { txt: '确定', iconClass: "", value: 1 }]
        };
    },

    methods: {
        init: function init() {
            var _this17 = this;

            headerTitleChange(2);
            var id = GetQueryString("id");
            ajax_.eventAndWarnUpdateUrl = getHeader.type === 2 ? "eventApproval" : "riskApproval";
            if (!isPush.flag) {
                getHeader.type = parseInt(sessionStorage.getItem("urlType"));
            }
            publicMethods.isDF(function () {
                _this17.getDetails(id, getHeader.type);
            }, function () {
                _this17.getFBD(id, getHeader.type);
            });
        },
        getDetails: function getDetails(id, type) {
            var _this18 = this;

            ajax_.getType(ajax_.eventAndWarnDetail[type] + id, {}, function (data) {
                data.format = detailsFun.approvalListFormat(data.approvalList, "approvalStatue");
                _this18.detailFormat(data, type);
            });
        },

        //地方网信办详情
        getFBD: function getFBD(id, type) {
            var _this19 = this;

            var url = ajax_.feedBackDetail[type];
            ajax_.postType(url, { id: id }, function (data) {
                var dd = data.result;
                var keys = ["", "", "eventManageTable", "riskManageTable"][getHeader.type];
                _this19.detailFormat(dd[keys], type, dd);
            });
        },

        //通用详情格式化
        detailFormat: function detailFormat(val, type, data2) {
            var data = val;
            data.operateFlag = publicMethods.eventAndWarnOperateShowFlagFormat(data, data2);
            data.format = detailsFun.approvalListFormat(data.approvalList, "approvalStatue");
            if (type === 2) {
                data.baseInfo = eventKeys.init(data);
            } else {
                data.baseInfo = warnKeys.init(data);
            }
            if (data2) {
                data.downsSet2 = data2.downsSet;
                data.totalNum2 = data2.totalNum;
                data.feedbackNum2 = data2.feedbackNum;
                data.noFeedbackNum2 = data2.noFeedbackNum;
            }
            this.details = data;
            publicData.details = data;
            this.showControl(data2);
            this.bodyShow = true;
        },

        //权限控制
        showControl: function showControl(data2) {
            var _this20 = this;

            if (this.details.operateFlag) {
                //请示领导
                if (this.details.operateFlag.leaderCheck) {
                    this[publicData.keyDetailsVal[1]] = {
                        id: [],
                        txt: "点此选择厂商",
                        textarea: ""
                    };
                }
                //下发流程
                if (this.details.operateFlag.release) {
                    this[publicData.keyDetailsVal[3]] = {
                        id: [],
                        txt: "点此选择地方网信办",
                        textarea: ""
                    };
                    this[publicData.keyDetailsVal[5]] = {
                        id: [],
                        txt: "点此选择厂商",
                        textarea: ""
                    };
                    publicData.releaseCs = [];
                    publicData.releaseDf = [];
                    setTimeout(function () {
                        _this20.switchInit();
                    }, 50);
                }
                //下发后获取反馈列表
                if (this.details.operateFlag.csAndDfFeedBackList) {
                    this.feedBackListGet();
                }
                if (this.details.operateFlag.dfFeedBackTxt) {
                    this.details.dfSummaryTxt = {
                        advice: this.details.replyClaim,
                        createTime: "",
                        userID: this.details.createUserInfo.linkdoodID,
                        userInfo: this.details.createUserInfo
                    };
                }
                if (this.details.operateFlag.csFeedBackTxt) {
                    this.details.csSummaryTxt = {
                        advice: this.details.handleClaim,
                        createTime: "",
                        userID: this.details.createUserInfo.linkdoodID,
                        userInfo: this.details.createUserInfo
                    };
                }
                if (this.details.operateFlag.dwRelease) {
                    this[publicData.keyDetailsVal[7]] = {
                        id: [],
                        txt: "点此选择运营单位",
                        textarea: ""
                    };
                    publicData.dwList = [];
                }
                //运营单位反馈列表获取
                if (this.details.operateFlag.dwTxt) {
                    this.details.dwTxt = {
                        advice: this.details.replyClaim,
                        userInfo: data2[publicData.dwTxtKey()].createUserInfo
                    };
                }
                if (this.details.operateFlag.dwReleaseList) {
                    this.dwFeedBackList();
                }
            }
        },
        switchInit: function switchInit() {
            var _this21 = this;

            if (document.getElementById("mySwitch")) {
                mui('.mui-switch')['switch']();
                document.getElementById("mySwitch").addEventListener("toggle", function (event) {
                    if (event.detail.isActive) {
                        _this21.switch_cs_show = true;
                    } else {
                        _this21.switch_cs_show = false;
                    }
                });
            }
        },
        openAction: function openAction(v) {
            this.actionShow = true;
            this.actionUserID = v.userInfo.linkdoodID;
            this.actionUserPhone = v.userInfo.cellphone;
        },
        actionClick: function actionClick(i) {
            switch (i) {
                case "c1":
                    vrv.jssdk.openChat({
                        chatId: parseInt(this.actionUserID),
                        success: function success(res) {}
                    });
                    break;
                case "c2":
                    vrv.jssdk.callPhone({
                        phoneNum: this.actionUserPhone,
                        success: function success(res) {}
                    });
                    break;
            }
        },
        goPeopleList: function goPeopleList(val) {
            goPathWithParams("/details/peopleList?roleId=" + val);
        },

        //领导按钮点击
        leaderBtnAction: function leaderBtnAction(type) {
            // this.adviceFormat(type);
            var data = {
                type: type,
                baseID: this.details.baseID,
                advice: adviceTextarea
            };
            ajax_.confirmPutTypeWithLoading(ajax_.eventAndWarnUpdateUrl, data, function () {
                alertBackRefreshList();
            });
        },

        //发布
        releaseAction: function releaseAction() {
            var df = this[publicData.keyDetailsVal[3]];
            var cs = this[publicData.keyDetailsVal[5]];
            var data = {
                baseID: this.details.baseID,
                replyClaim: df.textarea, //应对要求
                downsSet: JSON.stringify(df.id) //选择的下发单位
            };
            if (this.switch_cs_show) {
                data.handleClaim = cs.textarea;
                data.manufacturers = JSON.stringify(cs.id);
                if (!cs.id.length) {
                    mui.toast("请选择协助厂商");
                    return;
                }
                if (!data.handleClaim.trim()) {
                    mui.toast("请输入跟踪要求");
                    return;
                }
            }
            if (!df.id.length) {
                mui.toast("请发布单位");
                return;
            }
            if (!data.replyClaim.trim()) {
                mui.toast("请输入应对要求");
                return;
            }
            ajax_.confirmWithLoading(ajax_.eventAndRiskRelease[getHeader.type], "post", data, function () {
                alertBackRefreshList();
            });
        },

        //归档
        archiveBtnAction: function archiveBtnAction() {
            var options = {
                id: this.details.baseID,
                data: {
                    advice: adviceTextarea
                }
            };
            ajax_._archiveUrl(options);
        },
        adviceFormat: function adviceFormat(type) {
            var str = void 0;
            if (!adviceTextarea) {
                switch (parseInt(type)) {
                    case 2:
                        str = "同意";
                        break;
                    case 3:
                        str = "退回";
                        break;
                }
            } else {
                str = adviceTextarea;
            }
            adviceTextarea = str;
        },

        //反馈处理成功刷新页面
        dealFeedBackSuccess: function dealFeedBackSuccess() {
            var _this22 = this;

            this.bodyShow = false;
            this.init();
            scrollTriggerDownScroll();
            alert_(function () {
                _this22.pageUpShow = false;
            });
        },

        // type 1.转批 2.同意 3.退回 4.归档 5.下发
        btnClick: function btnClick(val) {
            switch (val) {
                case 5:
                    this.releaseAction();
                    break;
                case 6:
                    this.feedBackSubmit();
                    break;
                default:
                    this.leaderBtnAction(val);
            }
        },

        //地方网信办下发
        dfRelease: function dfRelease() {
            var dw = this[publicData.keyDetailsVal[7]];
            var data = {
                id: GetQueryString("id"),
                replyClaim: dw.textarea, //应对要求
                downsSet: JSON.stringify(dw.id) //选择的下发单位
            };
            if (!data.id.length) {
                mui.toast("请发布单位");
                return;
            }
            if (!data.replyClaim.trim()) {
                mui.toast("请输入应对要求");
                return;
            }
            ajax_.confirmWithLoading(ajax_.dfRelease[getHeader.type], "post", data, function () {
                alertBackRefreshList();
            });
        },

        //反馈提交
        feedBackSubmit: function feedBackSubmit() {
            var _this23 = this;

            var data = { status: 1 };
            data.id = GetQueryString("id");
            var arr = this.details.operateFlag.feedBackForm;
            arr.forEach(function (i) {
                var key = i.name;
                var val = document.getElementById(key).value;
                if (val) {
                    data[key] = val;
                }
            });
            var url = ajax_.feedBackSubmit[getHeader.type];
            ajax_.confirmPutTypeWithLoading(url, data, function () {
                _this23.dealFeedBackSuccess();
            });
        },

        //获取反馈统计
        feedBackListGet: function feedBackListGet() {
            var _this24 = this;

            var data = {
                size: 99999,
                page: 1,
                baseID: this.details.baseID
            };
            data.downsSet = this.details.downsSet;
            var url = ajax_.eventAndRiskFeedbackSummary[getHeader.type];
            ajax_.postType(url, data, function (data) {
                var arr = data.result.records;
                if (arr.length) {
                    _this24.$set(_this24.details, "dfSummaryList", publicMethods.csAndDfFeedBackListFormat.init(arr));
                }
            });
            if (this.details.manufacturers != null) {
                data.downsSet = this.details.manufacturers;
                ajax_.postType(url, data, function (data) {
                    _this24.$set(_this24.details, "csSummaryList", publicMethods.csAndDfFeedBackListFormat.init(data.result.records));
                });
            }
        },

        //查看反馈详情
        checkFeedBackDetail: function checkFeedBackDetail(item, flag) {
            publicData.checkedFeedBackDetail = item;
            goPathWithParams("/details/feedBackDetail?type=" + flag);
        },
        dealFeedBackAjax: function dealFeedBackAjax(val) {
            var self = this;
            var type = [0, 1, 3, 2];
            var data = {
                fId: publicData.checkedFeedBackDetail.id,
                exStatus: val, //1--确认;2--继续跟踪;3--终止反馈
                infoType: type[getHeader.type] //2--预警；3--事件
            };
            if (val === 1) {
                data.content = "值班员确认";
            } else if (val === 2) {
                data.content = mui("#ft")[0].value;
            } else if (val === 3) {
                data.content = "值班员终止反馈";
            }
            ajax_.confirmWithLoading(ajax_.circulationRecordTable, "post", data, function (data) {
                if (data.code == 1) {
                    self.dealFeedBackSuccess();
                } else {
                    mui.toast(ajax_.code0Txt);
                }
            });
        },

        //处理反馈
        dealFeedBack: function dealFeedBack(item, flag) {
            // 1--确认;2--继续跟踪;3--终止反馈
            publicData.checkedFeedBackDetail = item;
            if (flag === 3) {
                this.dealFeedBackAjax(3);
            } else if (flag === 5) {
                goPathWithParams("/details/feedBackDetail?type=5");
            } else {
                this.dealFeedBackActionShow = true;
            }
        },
        dealFeedBackActionClick: function dealFeedBackActionClick(i) {
            // 1.确定 2.继续跟踪
            if (i === 1) {
                this.dealFeedBackAjax(i);
            } else {
                this.pageUpShow = true;
            }
        },
        getAdvice: function getAdvice(e) {
            adviceTextarea = e.target.value;
        },

        //运营单位反馈列表
        dwFeedBackList: function dwFeedBackList() {
            var _this25 = this;

            var data = {
                size: 99999,
                page: 1,
                baseID: this.details.baseID
            };
            data.downsSet = this.details.downsSet2;
            var url = ajax_.eventAndRiskFeedbackSummary[getHeader.type];
            ajax_.postType(url, data, function (data) {
                var arr = data.result.records;
                if (arr.length) {
                    _this25.$set(_this25.details, "dwReleaseList", publicMethods.csAndDfFeedBackListFormat.init(arr));
                }
            });
        }
    },
    components: {
        foldWrap: foldWrap,
        detailsItemWrap: detailsItemWrap,
        noDataWrap: noDataWrap,
        actionSheetWrap: actionSheetWrap
    },
    mounted: function mounted() {
        var _this26 = this;

        APP.$on("isPush", function () {
            _this26.init();
        });
        APP.$on("peopleListCheck", function (data) {
            _this26[publicData.keyDetailsVal[data.id]].id = data.checked.map(function (i) {
                return i[publicData.keyIDPeopleList[data.id]];
            });
            _this26[publicData.keyDetailsVal[data.id]].txt = data.checked.map(function (i) {
                return i[publicData.keyOrgNameDetail[data.id]];
            }).join(",");
        });
        isPush.init(this.init);
    },
    beforeDestroy: function beforeDestroy() {
        APP.$off("peopleListCheck");
        APP.$off("isPush");
        store.dispatch("showFlag_action", 20);
    }
};

var feedBackDetailPage = {
    template: feedBackDetailTem,
    data: function data() {
        return {
            type: 0,
            bodyShow: false,
            feedBackDetails: []
        };
    },

    methods: {
        init: function init() {
            this.type = parseInt(GetQueryString("type"));
            if (this.type === 1) {
                this.feedBackDetails.push(publicData.feedBackKeys.init(publicData.checkedFeedBackDetail));
                this.bodyShow = true;
            } else {
                this.checkFeedBackHistoryListGet(this.type);
            }
        },

        //流转详情获取
        checkFeedBackHistoryListGet: function checkFeedBackHistoryListGet(flag) {
            var _this27 = this;

            ajax_.withLoading(ajax_.feedBackHistoryList, "post", { fId: publicData.checkedFeedBackDetail.id }, function (data) {
                if (flag === 2) {
                    var vv = publicData.feedBackKeys.historyListInit(data.result);
                    _this27.feedBackDetails = vv.map(function (i) {
                        return JSON.parse(i);
                    });
                }
                if (flag === 5) {
                    _this27.feedBackDetails.push(publicData.feedBackResult.init(data.result[0]));
                }
                _this27.bodyShow = true;
            });
        }
    },
    created: function created() {
        this.init();
    }
};

var infoDetail = {};
var newsDetails = {
    template: newsDetailsTem,
    data: function data() {
        return {
            details: { approvalList: [] },
            actionShow: false,
            bodyShow: false,
            editFlag: false,
            btnShow: false,
            leaderListBtnShow: false,
            routerFlag: 0,
            actionUserID: "",
            actionUserPhone: "",
            actionData: [{ txt: '发起对话', iconClass: "action-icon-chat", value: "" }, { txt: '拨打电话', iconClass: "action-icon-call", value: "" }]
        };
    },

    methods: {
        init: function init() {
            headerTitleChange(12);
            this.getDetails();
        },
        getDetails: function getDetails() {
            var _this28 = this;

            ajax_.getType(ajax_.newsUrl + "/" + GetQueryString("id"), {}, function (data) {
                publicData.itemDetails = data;
                var forDetails = detailsFun.approvalListFormat(data.approvalList, "status");
                data.approvalList = forDetails.newArr;
                if (data.approvalUserID == userInfo.id) {
                    if (data.status == 2) {
                        _this28.btnShow = true;
                        _this28.leaderListBtnShow = true;
                    } else if (data.status == 1) {
                        _this28.btnShow = true;
                    }
                }
                _this28.details = data;
                _this28.bodyShow = true;
            });
        },
        deleteNews: function deleteNews() {
            confirm_(function () {
                console.log(1232);
            });
        },
        checkNews: function checkNews(v) {
            infoDetail = v;
            goName("newsDetails_info");
        },
        openAction: function openAction(v) {
            this.actionShow = true;
            this.actionUserID = v.userID;
            this.actionUserPhone = v.userInfo.cellphone;
        },
        actionClick: function actionClick(i) {
            if (i === 1) {
                vrv.jssdk.callPhone({
                    phoneNum: this.actionUserPhone,
                    success: function success(res) {}
                });
            } else {
                vrv.jssdk.openChat({
                    chatId: parseInt(this.actionUserID),
                    success: function success(res) {}
                });
            }
        },
        goAddList: function goAddList() {
            goName("newsAdd");
        },
        btnClick: function btnClick(index) {
            if (index === 1) {
                goPathWithParams("/news/peopleList?roleId=1");
            } else {
                var data = {
                    advice: adviceTextarea, //研判意见
                    type: index //1.转批  2.同意  3.退回
                };
                ajax_.confirmPutTypeWithLoading("bulletinApproval/" + publicData.itemDetails.id, data, function () {
                    alert_(function () {
                        scrollTriggerDownScroll();
                        goBack();
                    });
                });
            }
        },
        getAdvice: function getAdvice(e) {
            adviceTextarea = e.target.value;
        }
    },
    components: {
        foldWrap: foldWrap,
        noDataWrap: noDataWrap,
        detailsItemWrap: detailsItemWrap,
        actionSheetWrap: actionSheetWrap
    },
    mounted: function mounted() {
        var _this29 = this;

        APP.$on("isPush", function () {
            _this29.init();
        });
        isPush.init(this.init);
        APP.$on("headerConfirm_12", function () {
            _this29.editFlag = false;
            store.commit("_headerType", 3);
            _this29.drag.destroy();
        });
        APP.$on("headerEdit_12", function () {
            _this29.editFlag = true;
            _this29.drag = Sortable.create(document.getElementById("sort"), {
                group: "news",
                animation: 150
            });
            store.commit("_headerType", 2);
        });
    },
    beforeDestroy: function beforeDestroy() {
        APP.$off("headerConfirm");
        APP.$off("headerEdit");
        store.commit("_headerType", 99);
        store.dispatch("showFlag_action", 1);
    }
};

var addNewsListWrap = {
    template: addNewsListTem,
    data: function data() {
        return {
            bodyShow: true,
            keyWords: "",
            checked: [],
            newsList: [1, 2, 3, 4, 5]
        };
    },

    methods: {
        inputValue: function inputValue(v) {
            this.keyWords = v;
        }
    },
    components: {
        searchWrap: searchWrap
    },
    created: function created() {
        store.commit("_headerType", 2);
        store.commit("_showFlag", 11);
        this.checked = publicData.newsAddChecked;
    },
    mounted: function mounted() {
        var _this30 = this;

        APP.$on("headerConfirm_11", function () {
            publicData.newsAddChecked = _this30.checked;
            goBack();
        });
    },
    beforeDestroy: function beforeDestroy() {
        APP.$off("headerConfirm_11");
        publicData.newsAddChecked = this.checked;
        publicMethods.backDetail();
    }
};

var infoDetailPage = {
    template: infoTem,
    data: function data() {
        return {
            details: 99,
            bodyShow: false
        };
    },
    created: function created() {
        store.commit("_headerType", 99);
    },
    mounted: function mounted() {
        var _this31 = this;

        ajax_.getTypeData(ajax_.infoDetail + infoDetail.id, {}, function (data) {
            var v = data.result;
            switch (parseInt(v.infoType)) {
                case 1:
                    v.extend.type = publicMethods.infoTypeTxtFormat.init(infoDetail.extend.type);
                    break;
                case 2:
                    v.extend.primaryRiskGrade = publicMethods.eventLevelToString(parseInt(v.extend.primaryRiskGrade));
                    break;
                case 3:
                    v.extend.primaryEventGrade = publicMethods.eventLevelToString(parseInt(v.extend.primaryEventGrade));
                    break;
            }
            _this31.details = v;
            _this31.bodyShow = true;
        });
    },
    beforeDestroy: function beforeDestroy() {
        store.commit("_headerType", 3);
    }
};